<?php // content="text/plain; charset=utf-8"
error_reporting(E_ALL & ~E_NOTICE);
require_once ('jpgraph.php');
require_once ('jpgraph_line.php');
require_once ("../connect/connect.php");


$month = date("m");
$year = date("Y");
$strSQL = "SELECT amount FROM sale WHERE month(date) = '$month' AND year(date) = '$year' ORDER BY day(date)";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$datay1=array();
while($objResult = mysql_fetch_array($objQuery))
{
$datay1[] = $objResult["amount"]; 
}

$month = date("m");
$year = date("Y");
$strSQL = "SELECT day(date) as date FROM sale WHERE month(date) = '$month' AND year(date) = '$year' ORDER BY day(date)";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$datax = array();
while($objResult1 = mysql_fetch_array($objQuery))
{
$datax[] = $objResult1["date"]; 
}
// Setup the graph
$graph = new Graph(550,180);
$graph->SetScale("textlin");

$theme_class=new UniversalTheme;

$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
$graph->SetBox(false);

$graph->img->SetAntiAliasing();

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);

$graph->xgrid->Show();
$graph->xgrid->SetLineStyle("solid");
$graph->xaxis->SetTickLabels($datax);
$graph->xgrid->SetColor('#E3E3E3');

// Create the first line
$p1 = new LinePlot($datay1);
$graph->Add($p1);
$p1->SetColor("#6495ED");


$graph->legend->SetFrameWeight(1);

// Output line
$graph->Stroke();

?>